import http from '../index'

// 分页获取营销活动
export const getBusinesses = ({ ascended = null, current = null, size = null, sortFieldName = null, status = null, markingType = null }) => {
    return http.get("business", { ascended, current, size, sortFieldName, status, markingType })
}

// 根据sid获取营销活动
export const getBusinessDetail = ({ sid }) => {
    return http.get("business/" + sid)
}

// 新增营销活动
export const addBusiness = ({ markingType, note, minAmount = null, prezzieNum = null, prezzieType = null, reductionAmount = null, status = null }) => {
    return http.post("business", { markingType, note, minAmount, prezzieNum, prezzieType, reductionAmount, status })
}

// 修改营销活动
export const editBusiness = ({ sid, markingType, note, minAmount = null, prezzieNum = null, prezzieType = null, reductionAmount = null, status = null }) => {
    return http.put("business/" + sid, { markingType, note, minAmount, prezzieNum, prezzieType, reductionAmount, status })
}

// 批量删除营销活动
export const delBusinesss = ({ sidList }) => {
    return http.put("business/delete", { sidList })
}

// 根据sid启用-停用营销活动
export const changeBusinessStatus = ({ sid }) => {
    return http.put("business/" + sid + '/status')
}



